package com.zy.studentSide.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zy.studentSide.entity.StudentClassroom;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author 29787
 */
@Mapper
@Component
public interface StudentClassroomDao extends BaseMapper<StudentClassroom> {

    /**
     * 根据学生id查询已加入的班级信息
     * @param studentId
     * @return List<StudentClassroom>
     */
    @Select("select * from hms_student_classroom where student_id=#{studentId}")
    List<StudentClassroom> getJoinClassroomByStudentId(Integer studentId);

    /**
     * 根据学生id,老师id，班级id查询班级信息
     * @param studentId
     * @param teacherId
     * @param classroomId
     * @return StudentClassroom
     */
    @Select("select * from hms_student_classroom where student_id=#{studentId} and teacher_id=#{teacherId} and classroom_id=#{classroomId}")
    StudentClassroom getClassroomByStudentIdAndTeacherIdAndClassroomId(Integer studentId,Integer teacherId,Integer classroomId);
}
